﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
	String basePath = "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="/">
<!-- 下拉框 -->
<link rel="stylesheet" href="static/ace/css/chosen.css" />
<!-- jsp文件头和头部 -->
<%@ include file="../index/top.jsp"%>
<!-- 日期框 -->
<link rel="stylesheet" href="static/ace/css/datepicker.css" />
</head>
<body class="no-skin">

	<!-- /section:basics/navbar.layout -->
	<div class="main-container" id="main-container">
		<!-- /section:basics/sidebar -->
		<div class="main-content">
			<div class="main-content-inner">
				<div class="page-content">
					<div class="row">
						<div class="col-xs-12">
						
						<!-- 检索  -->
						<form action="verion/list.do" method="post" name="versionForm" id="versionForm">
						<table style="margin-top:5px;">
							<tr>
								<td>
									<div class="nav-search">
					 				<span class="input-icon">
										<input class="nav-search-input" autocomplete="off" id="nav-search-input" type="text" name="names" value="${pd.name}" placeholder="这里输入版本名" />
										<i class="ace-icon fa fa-search nav-search-icon"></i>
									</span>
									</div>
								</td>
								<c:if test="${QX.cha == 1 }">
								<td style="vertical-align:top;padding-left:2px;"><a class="btn btn-light btn-xs" onclick="searchs();"  title="检索"><i id="nav-search-icon" class="ace-icon fa fa-search bigger-110 nav-search-icon blue"></i></a></td>
								</c:if>
							</tr>
						</table>
						<!-- 检索  -->
					
						<table id="simple-table" class="table table-striped table-bordered table-hover"  style="margin-top:5px;">
							<thead>
								<tr>
									<th class="center" style="width:2%;">排序</th>
									<th class="center" style="width:2%;">ID</th>
									<th class="center" style="width:7%;">app版本名</th>
									<th class="center" style="width:7%;">app版本号</th>
									<th class="center" style="width:25%;">app描述</th>
                                    <th class="center" style="width:25%;">app下载地址</th>
                                    <th class="center" style="width:7%;">二维码</th>
									<th class="center" style="width:10%;">日期</th>
									<th class="center" style="width:5%;">类型</th>
                                    <th class="center" style="width:3%;">是否强推</th>
									<th class="center" style="width:10%;">操作</th>
								</tr>
							</thead>
													
							<tbody id="versionList">
								
							<!-- 开始循环 -->	
							<c:choose>
								<c:when test="${not empty versionList}">
									<c:if test="${QX.cha == 1 }">
									<c:forEach items="${versionList}" var="version" varStatus="vs">
												
										<tr>
											<td class="center">${vs.index+1}</td>
											<td class="center">${version.id }</td>
											<td class="center">${version.app_version_name }</td>
											<td class="center">${version.app_version_code }</td>
											<td class="center">${version.app_describe }</td>
                                            <td class="center">${version.apk_url }</td>
                                            <td class="center">
                                            <c:if test="${version.qcode_url ==null}">
                                              <img  src="<%=basePath%>static/images/default.png" width="100px" height="100px;"/>
                                            </c:if>
                                            <c:if test="${version.qcode_url !=null}">
                                              <a href="${version.qcode_url }" target='_blank'><img src="${version.qcode_url }" height="100px;"  alt="图片"/></a>
                                            </c:if>
                                            </td>
											<td class="center">${version.app_date }</td>
											<td class="center">${version.app_type }</td>
                                            <td class="center"><c:if test="${version.is_push =='00'}">否</c:if><c:if test="${version.is_push =='01'}">是</c:if></td>
											<td class="center">
											<c:if test="${QX.edit == 1 }">
												<a class="btn btn-xs btn-success" title="编辑" onclick="editVersion('${version.id}');">
													<i class="ace-icon fa fa-pencil-square-o bigger-120" title="编辑"></i>
												</a>
										    </c:if>
									      <c:if test="${QX.del == 1 }">
													<a class="btn btn-xs btn-danger" onclick="delVersion('${version.id}');">
														<i class="ace-icon fa fa-trash-o bigger-120" title="删除"></i>
													</a>
										</c:if>
									</c:forEach>
									</c:if>
									<c:if test="${QX.cha == 0 }">
										<tr>
											<td colspan="10" class="center">您无权查看</td>
										</tr>
									</c:if>
								</c:when>
								<c:otherwise>
									<tr class="main_info">
										<td colspan="13" class="center">没有相关数据</td>
									</tr>
								</c:otherwise>
							</c:choose>
							</tbody>
						</table>
						
					<div class="page-header position-relative">
					<table style="width:100%;">
						<tr>
								<td style="vertical-align:top;">
									<c:if test="${QX.add == 1 }">
									<a class="btn btn-mini btn-success" onclick="add();">新增</a>
									</c:if>
								</td>
								<td style="vertical-align:top;"><div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div></td>
							</tr>
					</table>
					</div>
					</form>
	
						</div>
						<!-- /.col -->
					</div>
					<!-- /.row -->
				</div>
				<!-- /.page-content -->
			</div>
		</div>
		<!-- /.main-content -->

		<!-- 返回顶部 -->
		<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
			<i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
		</a>

	</div>
	<!-- /.main-container -->

	<!-- basic scripts -->
	<!-- 页面底部js¨ -->
	<%@ include file="../index/foot.jsp"%>
	<!-- 删除时确认窗口 -->
	<script src="static/ace/js/bootbox.js"></script>
	<!-- ace scripts -->
	<script src="static/ace/js/ace/ace.js"></script>
	<!-- 日期框 -->
	<script src="static/ace/js/date-time/bootstrap-datepicker.js"></script>
	<!-- 下拉框 -->
	<script src="static/ace/js/chosen.jquery.js"></script>
	<!--提示框-->
	<script type="text/javascript" src="static/js/jquery.tips.js"></script>
	</body>

<script type="text/javascript">
$(top.hangge());
//检索
function searchs(){
	top.jzts();
	$("#versionForm").submit();
}
//新增
function add(){
	 top.jzts();
	 var diag = new top.Dialog();
	 diag.Drag=true;
	 diag.Title ="新增";
	 diag.URL = '<%=basePath%>verion/goAddVersion.do';
	 diag.Width = 1100;
	 diag.Height = 800;
	 diag.CancelEvent = function(){ //关闭事件
		 if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
			 if('${page.currentPage}' == '0'){
				 top.jzts();
				 setTimeout("self.location=self.location",100);
			 }else{
				 nextPage('${page.currentPage}');
			 }
		}
		diag.close();
	 };
	 diag.show();
}

//修改
function editVersion(id){
	 top.jzts();
	 var diag = new top.Dialog();
	 diag.Drag=true;
	 diag.Title ="修改";
	 diag.URL = '<%=basePath%>verion/goEditAppVersion.do?id='+id;
	 diag.Width = 1100;
	 diag.Height = 800;
	 diag.CancelEvent = function(){ //关闭事件
		 if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
			nextPage('${page.currentPage}');
		}
		diag.close();
	 };
	 diag.show();
}
//删除
function delVersion(id){
	bootbox.confirm("确定要删除吗?", function(result) {
		if(result) {
			top.jzts();
			var url = "<%=basePath%>verion/deleteVersion.do?id="+id;
			$.get(url,function(data){
				if(data=="success"){
					alert("删除成功");
				}
				else{
					alert("删除失败");
				}
				nextPage('${page.currentPage}');
			});
		};
	});
}

		
function createCode(id){
	top.jzts();
	var url = "<%=basePath%>verion/createTwoDimensionCode.do?id="+id;
	$.get(url,function(data){
		if(data=="success"){
			alert("删除成功");
		}
		else{
			alert("删除失败");
		}
		nextPage('${page.currentPage}');
	});
	
}


		
</script>
</html>
